import request from '/@/utils/request';

export function fetchList(query?: Object) {
	return request({
		url: '/admin/accessDevice/page',
		method: 'get',
		params: query,
	});
}
export function fetchListNoPage(query?: Object) {
	return request({
		url: '/admin/accessDevice/list',
		method: 'get',
		params: query,
	});
}

export function getObj(id?: string) {
	return request({
		url: '/admin/accessDevice/detail?unitNo=' + id,
		method: 'get',
	});
}

export function delObjs(ids?: Object) {
	return request({
		url: '/admin/accessDevice',
		method: 'delete',
		data: ids,
	});
}
export function addObj(obj?: Object) {
	return request({
		url: '/admin/accessDevice',
		method: 'post',
		data: obj,
	});
}
export function editObj(obj?: Object) {
	return request({
		url: '/admin/accessDevice/startStop',
		method: 'put',
		data: obj,
	});
}
//设备详情属性历史
export function getDevicePropertyLogs(query?: Object) {
    return request({
		url: '/admin/dataflowoperation/queryFieldValue',
		method: 'get',
		params: query,
	});
}
//服务调用
export function serviceInvoke(query?: Object) {
    return request({
		url: '/admin/accessDevice/service/invoke',
		method: 'post',
		data: query,
	});
}
//批量导入设备
export function importDev(query?: Object) {
    return request({
		url: '/admin/accessDevice/import',
		method: 'post',
		headers: { 'Content-Type': 'multipart/form-data' },
		data: query,
    })
}